package message.handler;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Hashtable;
import message.handler.*;
/**
 *
 * @author kinder
 */
public class MessageHandlerFactory {

    private Hashtable mapHandler = new Hashtable();

    public MessageHandlerFactory()
    {
        addHandlerForType("FILEBACKEND", new FileBackEndHandler());
        addHandlerForType("QUIT", new QuitHandler());
        //addHandlerForType("CHATLOGBACKEND", new ChatLogBackEndHandler());
    }

    public void addHandlerForType(String type, MessageHandler handler)
    {
        mapHandler.put(type, handler);
    }

    public MessageHandler getHandlerForType(String type)
    {
        MessageHandler h = (MessageHandler) mapHandler.get(type);
        return h;
    }
}
